let scopeIndexDataSerial = 0;
async function httpLoader(e) {
    return new Promise(function(t, n) {
        const s = new XMLHttpRequest;
        s.open("GET", e),
            s.responseType = "text",
            s.onreadystatechange = function() {
                if (4 === s.readyState) if (s.status >= 200 && s.status < 300) {
                    const n = s.responseText.replace(/\r?\n/g, "\n"),
                        c = (new DOMParser).parseFromString(n, "text/html"),
                        r = "data-s-" + (scopeIndexDataSerial++).toString(36);
                    let i = {},
                        a = "";
                    for (const t of c.head.childNodes) switch (t.nodeName) {
                        case "TEMPLATE":
                            const n = document.createElement("div");
                            n.innerHTML = t.innerHTML,
                                n.setAttribute(r, "");
                            n.className = 'container';
                            const s = document.createElement("div");
                        function e(e) {
                            o(e.children)
                        }
                        function o(t) {
                            for (let n = 0; n < t.length; n++) t[n].setAttribute(r, ""),
                            t[n].children && e(t[n])
                        }
                            s.appendChild(n),
                                e(s),
                                a = s.innerHTML;
                            break;
                        case "SCRIPT":
                            const c = t.innerText.trim();
                            c.startsWith("export default") && (i = new Function("return " + c.substring(14))());
                            break;
                        case "STYLE":
                            let l = "";
                            if (t.hasAttribute("scoped")) {
                                const e = "[" + r + "]",
                                    n = t.sheet.cssRules;
                                for (let t = 0; t < n.length; ++t) {
                                    const s = n[t];
                                    if (1 !== s.type) continue;
                                    const o = [];
                                    s.selectorText.split(/\s*,\s*/).forEach(function(t) {
                                        o.push(e + " " + t);
                                        const n = t.match(/([^ :]+)(.+)?/);
                                        o.push(n[1] + e + (n[2] || ""))
                                    }),
                                        l += o.join(",") + s.cssText.substr(s.selectorText.length)
                                }
                            }
                            if (l.length > 0) {
                                let e = document.createElement("style");
                                e.innerText = l,
                                    e.setAttribute("scope-name", r);
                                const t = document.getElementsByTagName("style");
                                let n = !0;
                                for (const e of t) {
                                    const t = e.getAttribute("scope-name");
                                    if (t && t === r) {
                                        n = !1;
                                        break
                                    }
                                }
                                n && document.getElementsByTagName("head")[0].appendChild(e)
                            }
                    }
                    i.template = a,
                        t(i)
                } else n(s.status)
            },
            s.send(null)
    })
}